home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Snippets / Printing / PicCommentsTest / Globals.p next >
Encoding:
Text File  |  1992-06-11  |  2.4 KB  |  128 lines  |  [TEXT/PJMM]

  1. unit Globals;
  2.  
  3. interface
  4.  
  5.     uses
  6.         PrintTraps, PicComments;
  7.  
  8.     const
  9.         rMenuBar = 128;
  10.  
  11.         mApple = 128;
  12.         iAbout = 1;
  13.  
  14.         mFile = 129;
  15.         iPageSetup = 1;
  16.         iPrint = 2;
  17.         iQuit = 4;
  18.  
  19.         mEdit = 130;
  20.  
  21.         mSelect = 131;
  22.         iNone = 0;
  23.         iTextRotation = 1;
  24.         iLineLayout = 2;
  25.         iPolygon = 3;
  26.         iDashedLine = 4;
  27.         iLineWidth = 5;
  28.         iGraphicsRot = 6;
  29.         iPostScript = 7;
  30.  
  31.         rWindowID = 128;  { our main window }
  32.         rAboutAlert = 128; { About ... }
  33.         rPolyOptions = 129; { modal dlg window }
  34.         iFilled = 3;
  35.         iClosed = 4;
  36.         iUser = 6;
  37.         rTxtPicOptions = 130; { tJus, tFlip fields }
  38.         iJNone = 3;
  39.         iJLeft = 4;
  40.         iJCenter = 5;
  41.         iJRight = 6;
  42.         iJFull = 7;
  43.         iFNone = 8;
  44.         iFHoriz = 9;
  45.         iFVertic = 10;
  46.         iOKUser = 13;
  47.  
  48.         rStrings = 128; { list of strings }
  49.         iSuggestSelection = 1;
  50.         iRotatedText = 2; { used in unit "TestPicComments" }
  51.         iLineLayout1 = 3;
  52.         iLineLayout2 = 4;
  53.         iCommentRotate = 5; { tell them we don't rotate QuickDraw text (yet) }
  54.  
  55.         rFontNames = 129;
  56.         iTextRotFont = 1;
  57.         iLLFont1 = 2;
  58.         iLLFont2 = 3;
  59.  
  60.     var
  61.         gDone: Boolean;
  62.         gWP: WindowPtr; { our only window }
  63.         gWhichDemo: iNone..iPostScript;
  64.         gPrRec: THPrint; { global print record }
  65.         gPrPort: TPPrPort; { non-relocatable printing port }
  66.         gJus, gFlip: Integer; { for text rotation }
  67.         gFilled, gClosed: Boolean;  { for Polygon picture comments }
  68.  
  69.     procedure InitMac;  { Always the same }
  70.     procedure InitApp;  { Initialize my globals, and set up environment }
  71.  
  72.  
  73. implementation
  74.  
  75.     procedure InitMac;
  76.     begin
  77.         InitGraf(@thePort);
  78.         InitFonts;
  79.         FlushEvents(everyEvent, 0);
  80.         InitWindows;
  81.         InitMenus;
  82.         TEInit;
  83.         InitDialogs(nil);
  84.         InitCursor;
  85.     end;
  86.  
  87.  
  88.     procedure InitApp;
  89.         var
  90.             i: Integer;
  91.             ignore: Boolean;
  92.             menuBar: Handle;
  93.             evt: EventRecord;
  94.     begin
  95.         gDone := FALSE;
  96.         gJus := tJusNone;
  97.         gFlip := tFlipNone;
  98.         gFilled := FALSE;
  99.         gClosed := FALSE;
  100.         gWhichDemo := iNone;
  101.         gWP := GetNewWindow(rWindowID, nil, WindowPtr(-1));
  102.         if gWP = nil then
  103.             DebugStr('GetNewWindow failed');
  104.         SetPort(gWP);
  105.  
  106.         gPrPort := TPPrPort(NewPtr(SizeOf(TPrPort)));
  107.         if gPrPort = nil then
  108.             DebugStr('NewPtr(TPrPort) failed');
  109.  
  110.         gPrRec := THPrint(NewHandle(SizeOf(TPrint)));
  111.         if gPrRec = nil then
  112.             DebugStr('NewHandle(PrintRecord) failed');
  113.         PrintDefault(gPrRec);
  114.  
  115.         menuBar := GetNewMBar(rMenuBar);
  116.         if menuBar = nil then
  117.             DebugStr('GetNewMBar failed');
  118.  
  119.         SetMenuBar(menuBar);
  120.         DisposHandle(menuBar);
  121.         AddResMenu(GetMHandle(mApple), 'DRVR');
  122.         DrawMenuBar;
  123.         for i := 1 to 3 do
  124.             ignore := EventAvail(everyEvent, evt);
  125.     end;
  126.  
  127.  
  128. end.